<?php
/**
 * Created by PhpStorm.
 * User: Mysic
 * Date: 2020/10/20
 * Time: 16:02
 */

namespace app\common\mysic\order;


use app\common\model\VipCardOrder;
use app\common\mysic\MysicBase;
use think\Model;

class VipCardHandler extends MysicBase
{
    /**
     * @var VipCardOrder 模型对象
     */
    protected $model;
    /**
     * @var VipCardOrder 模型数据实例对象
     */
    protected $entity;
    protected $userOrder;
    public function setModel(Model $model)
    {
        $this->model = $model;
        return $this;
    }
    public function setUserOrder(Model $order)
    {
        $this->userOrder = $order;

        return $this;
    }
    public function isCardOrder()
    {
        return !empty($this->entity);
    }
    public function getBonusRate()
    {
        return $this->entity->bonus_percent;
    }
    public function instanceCardEntity()

    {
        $this->entity = $this->model->where('order_id', $this->userOrder->order_id)->find();
    }


}